<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="${package}.mapper.${table.className}Mapper">

    <resultMap id="SuperResultMap" type="${package}.po.${table.className}" extends="BaseResultMap">
        
	</resultMap>
    
    <sql id="Super_Sql_Where_Clause">
		<!-- ognl访问静态方法的表达式 为@class@method(args),以下为调用rapid中的Ognl.isNotEmpty()方法,还有其它方法如isNotBlank()可以使用，具体请查看Ognl类 -->
		<where>	      		
			<if test="@Ognl@isNotEmpty(q)" >
		        and username like CONCAT('%',${r'#{q}'},'%') 
		    </if>		
		    and status ='Valid' 
		</where>
	</sql>

    <select id="countSuper" resultType="int">
        SELECT count(1) FROM ${table.tableName} 
		<include refid="Super_Sql_Where_Clause"/>    
    </select>
    
    <select id="selectSuper" resultMap="SuperResultMap">
    	SELECT
			<include refid="Base_Column_List"/>
    	FROM ${table.tableName}  
    	<include refid="Super_Sql_Where_Clause"/>    
    	order by id desc
    	<if test="queryInfo != null and queryInfo.start != null and queryInfo.start>=0">
			limit ${r'#{queryInfo.start}'}, ${r'#{queryInfo.end}'}
		</if>
    </select>	

</mapper>